<template>
  <el-radio-group v-model="radioData" :disabled="disabled" @change="change">
    <el-radio
      v-for="(item, index) in options"
      :key="index"
      :label="item.value"
      :disabled="item.disabled"
    >
      {{ item.label }}
    </el-radio>
  </el-radio-group>
</template>
<script>
export default {
  name: 'Aradio',
  props: {
    value: {
      type: [Number, String],
    },
    options: {
      type: Array,
      default: () => [],
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      radioData: null,
      dialogVisible: false,
      addData: {},
    };
  },
  watch: {
    value: {
      handler(val) {
        this.radioData = val;
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    change(val) {
      this.$emit('input', val);
      this.$emit('change', val);
    },
  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-radio__label {
  padding-left: 4px;
}
</style>
